﻿@inherits Blazorise.DropdownToggle
<div class="dropdown-trigger">
    @if ( IsGroup )
    {
        <div class="control">
            <button @ref="@ElementRef" id="@ElementId" type="button" class="@ClassNames" style="@StyleNames" disabled="@IsDisabled" tabindex="@TabIndex" @onclick="@ClickHandler" @attributes="@Attributes">
                @if ( ChildContent != null )
                {
                    <span>@ChildContent</span>
                }
                @if ( IsToggleIconVisible )
                {
                    <span class="icon is-small">
                        @if ( ParentDropdownState.Visible )
                        {
                            <Icon Name="IconName.AngleUp" />
                        }
                        else
                        {
                            <Icon Name="IconName.AngleDown" />
                        }
                    </span>
                }
            </button>
        </div>
    }
    else
    {
        @if ( ParentDropdown?.IsDropdownSubmenu == true )
        {
            <a @ref="@ElementRef" id="@ElementId" class="@ClassNames" style="@StyleNames" disabled="@IsDisabled" tabindex="@TabIndex" @onclick="@ClickHandler" @attributes="@Attributes">
                @if ( ChildContent != null )
                {
                    <span>@ChildContent</span>
                }
                @if ( IsToggleIconVisible )
                {
                    <span class="icon is-small">
                        @if ( ParentDropdownState.Visible )
                        {
                            <Icon Name="IconName.AngleLeft" />
                        }
                        else
                        {
                            <Icon Name="IconName.AngleRight" />
                        }
                    </span>
                }
            </a>
        }
        else
        {
            <button @ref="@ElementRef" id="@ElementId" type="button" class="@ClassNames" style="@StyleNames" disabled="@IsDisabled" tabindex="@TabIndex" @onclick="@ClickHandler" @attributes="@Attributes">
                @if ( ChildContent != null )
                {
                    <span>@ChildContent</span>
                }
                @if ( IsToggleIconVisible )
                {
                    <span class="icon is-small">
                        @if ( ParentDropdownState.Visible )
                        {
                            <Icon Name="IconName.AngleUp" />
                        }
                        else
                        {
                            <Icon Name="IconName.AngleDown" />
                        }
                    </span>
                }
            </button>
        }
    }
</div>